package com.mingdong.second.guanchazhe.subject;

import java.util.ArrayList;
import java.util.List;

import com.mingdong.second.guanchazhe.observer.Observer;

public class WeatherDt implements Subject {

	private double mhuilmit;
	private double mtemplete;
	private double mpressure;
	
	private List<Observer> list = new ArrayList<Observer>();
	
	public void register(Observer o) {
		list.add(o);
	}

	public void remove(Observer o) {
		list.remove(o);
	}

	public void setDatas(double mhuilmit, double mtemplete, double mpressure){
		this.mhuilmit = mhuilmit;
		this.mtemplete = mtemplete;
		this.mpressure = mpressure;
		notifyAllObServer();
	}
	
	public void notifyAllObServer() {
		
		for (Observer o : list) {
			o.update(mhuilmit, mtemplete, mpressure);
		}
		
	}

}
